import { _decorator, Component, Node, RichText } from 'cc';
import { plog } from '../Utils/Tools';
import { ParamUI } from './ParamUI';
import UiManager from './UiManager';
const { ccclass, property } = _decorator;

@ccclass('Hint')
export class Hint extends Component {
    @property(RichText)
    Content: RichText = null;
    public Param: any


    onLoad(): void {
        let pu = this.node.getComponent(ParamUI)
        pu.RegisterCallbackOpen("-", (pm) => {
            this.Content.string = pm.label
            this.Param = pm.param
        })
        this.node.on(Node.EventType.TOUCH_END, this.onBtnBack, this);
    }
    onBtnBack(evt) {
        evt.bubbles = false
        UiManager.Instance.RemoveUI(this.node, this.Param)
    }

    onDestroy() {
        this.node.off(Node.EventType.TOUCH_END, this.onBtnBack, this);
    }

    start() {

    }
    update(deltaTime: number) {

    }
}


